package demo;


import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author : feixiang.li
 * @since : 2025-08-01 14:03
 */
public class Test111 {

    public static void main(String[] args) {
        List<AllocationIncomeDTO> allocationIncomeList = new ArrayList<>();
//        allocationIncomeList.add(new AllocationIncomeDTO(1L, 1L, "1", BigDecimal.valueOf(1)));
        allocationIncomeList.add(new AllocationIncomeDTO(null, null, "2", BigDecimal.valueOf(2)));
        allocationIncomeList.add(new AllocationIncomeDTO(1L, 1L, "3", null));
//        allocationIncomeList.add(null);
//        allocationIncomeList.add(new AllocationIncomeDTO());
        Map<String, BigDecimal> collect = allocationIncomeList.stream().collect(Collectors.toMap(item -> {
            return getKey(item);

        }, item -> {
//            return item.getFinanceAdjustAmount();
            return Objects.isNull(item.getFinanceAdjustAmount()) ? BigDecimal.ZERO : item.getFinanceAdjustAmount();
        }, (v1, v2) -> v1));
        System.out.println(collect);
//        Map<String,BigDecimal> collect = new HashMap<>();
//        collect.put(null,null);
//        System.out.println(collect.get(null));

    }


    /**
     * 获取key
     *
     * @param data 数据
     * @return key
     */
    public static String getKey(AllocationIncomeDTO data) {
        return  null;
//        return data.getBizNo() + "-" + data.getSpecId() + "-" + data.getWarehouseId();
    }

}
